package com.photonpay.api.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 交易通知code枚举
 *
 * @author ：lo-
 * @date ：Created in 2023/11/28 16:18
 */
@Getter
@AllArgsConstructor
public enum TransactionNotificationCodeEnum {
    SUCCESS("0000", "成功"),
    SYSTEM_EXCEPTION("9999", "系统异常"),
    WALLET_BALANCE_INSUFFICIENT("VCC1003", "钱包余额不足"),
    CARD_STATUS_ABNORMAL("VCC1009", "卡片状态异常"),
    SINGLE_TRANSACTION_LIMIT_EXCEEDED("VCC1010", "单笔限额超限"),
    DAILY_LIMIT_EXCEEDED("VCC1011", "日限额超限"),
    MONTHLY_LIMIT_EXCEEDED("VCC1012", "月限额超限"),
    CARD_TRANSACTION_LIMIT_EXCEEDED("VCC1013", "卡片交易限额超限"),
    RISK_CONTROL_REJECT("VCC1014", "风控拒绝"),
    WALLET_BALANCE_INSUFFICIENT_2("VCC1015", "钱包余额不足"),
    SYSTEM_EXCEPTION_2("VCC1017", "系统异常"),
    SYSTEM_EXCEPTION_3("VCC1018", "系统异常"),
    WALLET_ACCOUNT_ABNORMAL("VCC1025", "钱包账户异常"),
    CHANNEL_INTERCEPTED("VCC1027", "渠道拦截"),
    TRANSACTION_TIMEOUT("VCC1028", "交易超时");

    private final String code;
    private final String description;

    public static TransactionNotificationCodeEnum getByCode(String code) {
        for (TransactionNotificationCodeEnum status : TransactionNotificationCodeEnum.values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        return null;
    }
}
